<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>
        <h1>Do Ajax 01 Page</h1>
        <button onclick="doAjaxStart()">Ajax Get Request</button>
        <span id="result"></span>
    </div>
<script>
    function doAjaxStart(){
        let span = document.getElementById("result");
        span.innerHTML="Data is loading......";
        let xhr=new XMLHttpRequest();
        xhr.onreadystatechange=function (){
            if (xhr.readyState==4&&xhr.status==200){
                span.innerHTML=xhr.responseText;
            }
        }
        xhr.open("GET","http://localhost/doAjaxStart",true);
        xhr.send(null);
        console.log("=======main========")
    }
</script>
</body>
</html>